#!/usr/bin/ruby
#require "rubygems"
#require "nokogiri"
#require "open-uri"

#@current_url = "http://www.verycd.com/topics/274712/"
#@item_url = "http://page.renren.com/zhiwudazhanjiangshi/photo/3114270408"
#@html = open(@item_url)
#@doc = Nokogiri::HTML(open(@current_url))
#puts open(@current_url).read
#puts @doc.css("div.emulemain td a").last.attr("href").to_s
#puts @doc.css("title").empty?
#puts @html.read
#puts @current_url.scan(/album\/(\d+)/)[0].to_s + "_" + @doc.css("div.pager-top span h3").inner_text.to_s
#puts @doc.css("div.pager-top span").inner_text.to_s.scan(/共(\d+)张/)[0][0].to_i
#puts @current_url.scan(/http:\/\/[\w+\.]+/)[0].to_s
#puts /p[\w+_]+\.jpg/.match("http://fmn.rrfmn.com/fmn037/20100624/1155/p_large_Rx7d_6db200025df42d11.jpg")

#VALID_VERYCD_URL_REGEXP = {
#  :topic_url => /http:\/\/www\.verycd\.com\/topics\/\d+\//, 
#  :entry_url => /http:\/\/www\.verycd\.com\/entries\/\d+\//
#}
#
#puts VALID_VERYCD_URL_REGEXP.any? { |key, url| puts key, url }

#@current_url = "http://www.verycd.com/search/files/%E6%A4%8D%E6%9D%BE%E4%BC%B8%E5%A4%AB%28UEMATSU+NOBUO%29?x=Mjc0NzEy&sort=rel"
#@doc = Nokogiri::HTML(open(@current_url))
#@doc.css("#file-results tr td:eq(1) a")[0, 20].each { |a| puts a.attr("href") }

#@current_url = "http://www.verycd.com/files/1f33c208c827fcfdf8d2e98d8753359a116791296"
#@doc = Nokogiri::HTML(open(@current_url))
#puts @doc.css("input.downloadButton").attr("name").to_s

#puts File.directory?(File.dirname(File.expand_path(__FILE__)))
#
#require File.expand_path('../bible/bible_lib', __FILE__)
#
#s = "Hello, world! Hello, MOTO! Hello, world! Hello, MOTO! Hello, world!"
#puts Bible.split_word(s)

#start_time = Time.now
#filename = File.expand_path('../bible/bbe.txt', __FILE__)
#f = File.new(filename)
#while f.gets do
#    $_
#end
#f.close
#end_time = Time.now
#puts end_time - start_time

puts 'attitude'.downcase.each_byte.map{|i| i-96}.inject(0){|sum, x| sum+=x}
puts 'attitude'.sum - 96*'attitude'.length
